﻿@model KL.Store.Web.Models.ProductsModel
@using KL.Store.Core
@{
    Layout = null;
    var cssColumnClass = "";
    var showNamesBottom = false;
    var addToCartButtonStyle = 1;
    var columnCount = 4;
    var showcaseColumnCount = 4;
    var showcaseProductCount = Parameters.MaxProductCountForShowcaseProducts;
    if (Model.ColumnCount == 1)
    {
        cssColumnClass = "col-xs-6 col-sm-6 col-md-12 col-lg-12";
        columnCount = 1;
    }
    else if (Model.ColumnCount == 2)
    {
        cssColumnClass = "col-xs-6 col-sm-6 col-md-6 col-lg-6";
        columnCount = 2;
    }
    else if (Model.ColumnCount == 3)
    {
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-4";
        columnCount = 3;
    }
    else if (Model.ColumnCount == 4)
    {
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        columnCount = 4;
    }
    else if (Model.ColumnCount == 6)
    {
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-2";
        columnCount = 6;
    }
    else
    {
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        columnCount = 4;
        if (Parameters.Theme == "HA")
        {
            cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-4";
            columnCount = 3;
        }
    }
    var listImageType = "";
    if (Model.ListImageType == "w")
    {
        listImageType = "_w";
    }
    else if (Model.ListImageType == "t")
    {
        listImageType = "_t";
    }
    else if (Model.ListImageType == "s")
    {
        listImageType = "_s";
    }
    else
    {
        listImageType = "";
        if (Parameters.Theme == "HA")
        {
            listImageType = "_w";
        }
    }
    var mainWidth = "";

    if (Parameters.Theme == "HA")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-9 col-lg-10 right";
        showcaseColumnCount = 3;
    }
    else if (Parameters.Theme == "JB")
    {
        if (Parameters.HomePageCategoryId == Model.CategoryId && Parameters.Theme == "JB")
        {
            mainWidth = "col-xs-12 col-sm-12 col-md-12 col-lg-12 right first last";
        }
        else
        {
            mainWidth = "col-xs-12 col-sm-12 col-md-9 col-lg-10 right";
        }
    }
    else if (Parameters.Theme == "DK")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last right";
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        columnCount = 3;
        listImageType = "";
        showNamesBottom = true;
        addToCartButtonStyle = 2;
    }
    else if (Parameters.Theme == "WU")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-9 col-lg-9 right";
        cssColumnClass = "col-xs-6 col-sm-6 col-md-3 col-lg-3";
        columnCount = 4;
        listImageType = "";
        showNamesBottom = false;
        addToCartButtonStyle = 3;
    }
    else if (Parameters.Theme == "EO")
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last right";
        cssColumnClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
        columnCount = 3;
        listImageType = "";
        showNamesBottom = true;
        addToCartButtonStyle = 2;
    }
    else
    {
        mainWidth = "col-xs-12 col-sm-12 col-md-9 col-lg-10 right";
    }
    var firstLast = "";
    var mainfirstlast = "";
    if (Parameters.Theme == "HA")
    {
        firstLast = "first last";
        mainfirstlast = "first last";
    }
    else if (Parameters.Theme == "WU")
    {
        firstLast = "first last";
    }
}
<div class="@mainWidth @mainfirstlast">
    @if (Parameters.HomePageCategoryId != Model.CategoryId && Model.BreadCrumb != "")
    {
        if (Parameters.Theme == "HA" && Model.CategoryId == 1032)
        {

        }
        else
        {
        <div class="breadcrumb">
            <div class="bcBorder"></div>
            <div class="bcLinks">
                @Html.Raw(Model.BreadCrumb)
            </div>
            <div class="bcBorder"></div>
        </div>
        }

        if (Model.IsManager || Model.IsSeoManager)
        {
        <div class="edit-genel">
            @if (Model.IsManager)
            {
                <a href="/Products/AddProductToCategory/@(Model.CategoryId)" class="urunEkle fancybox.iframe" title="Kategoriye Ürün Ekle">
                    <i class="fa fa-link fa-2x"></i>
                </a>
                <a href="@Url.Action("Edit", "ProductManage", new { toEdit = "AddNewProduct", id = Model.CategoryId })" class="urunDuzenle fancybox.iframe" title="Yeni Ürün Ekle">
                    <i class="fa fa-plus-square-o fa-2x"></i>
                </a>
            }
            @if (Model.IsSeoManager)
            {
                <a href="/CategoryManage/Edit/@(Model.CategoryId)" class="kategoriDuzenle fancybox.iframe">
                    <i class="fa fa-edit fa-2x"></i>
                </a>
            }
        </div>
        }
    }
    @{if (Model.BannerActive)
      {
        <div class="hidden-xs hidden-sm col-md-12 col-lg-12 banner-alt @firstLast">
            <img src="@(Parameters.WebSiteImageUrl)/category-banner/@(Model.CategoryId).jpg" alt="@Model.CategoryName" />
        </div>
        <div class="clearfix"></div>
      }
      else if (Model.ParentBannerActive)
      {
        <div class="hidden-xs hidden-sm col-md-12 col-lg-12 banner-alt @firstLast">
            <img src="@(Parameters.WebSiteImageUrl)/category-banner/@(Model.ParentCategoryId).jpg" alt="@Model.CategoryName" />
        </div>
        <div class="clearfix"></div>
      }
    }
    @if (Parameters.HomePageCategoryId != Model.CategoryId && Parameters.ShowBrandSelection)
    {
        <h2 class="brand-category-title">Markalar</h2>
        <div class="brands">
            @{Html.RenderAction("GetBrands", "Products", new { id = Model.CategoryId });}
            <div class="clearfix"></div>
        </div>
    }

    @if (Parameters.HomePageCategoryId != Model.CategoryId && Model.RelatedCategoryCount >= 1 && Parameters.ShowSubCategories)
    {
        Html.RenderAction("GetSubCategories", "Categories", new { id = Model.CategoryId });
    }



    @if (Parameters.HomePageCategoryId != Model.CategoryId && Model.Brand < 1 && Model.RelatedProducts.Count > Parameters.MaxProductCountForPage)
    { 
        <div>
            Kategoriye ait ürün sayısı fazla olduğundan ilk @(Parameters.MaxProductCountForPage) adet ürün listelenmektedir. Lütfen yukarıda bulunan markalardan seçim yapınız.
        </div>
        Model.RelatedProducts = Model.RelatedProducts.Take(Parameters.MaxProductCountForPage).ToArray<KL.Store.Core.Domain.Product>();
    }

    @if (ViewBag.Page == 1 && Model.ShowcaseGroup > 0 && Parameters.MaxProductCountForShowcaseProducts > 0)
    {
        <div class="orderProducts">
            <div class="opBorder"></div>
            <div class="opLinks">
                <span>Vitrin Ürünleri</span>
            </div>
            <div class="opBorder"></div>
        </div>
        <div class="showcaseProducts">
            @{Html.RenderAction("Get2", "Products", new { id = Model.ShowcaseGroup, itemCount = showcaseProductCount, ColumnCount = showcaseColumnCount, ListImageType = listImageType.Replace("_", ""), sort = 6, showTextTitle = false, showcase = true });}
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
    }
    @if (Model.RelatedProducts.Count >= 1 && Parameters.HomePageCategoryId != Model.CategoryId)
    { 
        <div class="orderProducts">
            <div class="opBorder"></div>
            <div class="opLinks">
                @if (Parameters.Theme == "HA")
                {
                    <h1>
                        @Model.CategoryName
                    </h1>
                }
                <div class="orderAndPagination">
                    @*sıralama*@
                    @if (Parameters.ShowOrderOptionsAsDropdown)
                    {
                        <select class="SortAndOrderSelect">
                            <option disabled="disabled">Sıralama</option>
                            <option value="SortSales"@{ if (Model.Sort == 4)
                                                        {<text> selected="selected"</text>}}>Çok Satılana Göre</option>
                            <option value="SortPrice"@{ if (Model.Sort == 2 && Model.Order == 1)
                                                        {<text> selected="selected"</text>}}>Fiyata Artan</option>
                            <option value="SortPriceDesc"@{ if (Model.Sort == 2 && Model.Order == 2)
                                                            {<text> selected="selected"</text>}}>Fiyata Azalan</option>
                            <option value="SortName"@{ if (Model.Sort == 1)
                                                       {<text> selected="selected"</text>}}>A'dan Z'ye</option>
                            <option value="SortDate"@{ if (Model.Sort == 3)
                                                       {<text> selected="selected"</text>}}>Yeniden Eskiye</option>
                        </select>
                    }
                    else
                    {
                        <div class="orderList">
                            <span>Sıralama:</span>
                            <a onclick="SortSales()" id="opCokSatilan" class="opLink@{ if (Model.Sort == 4)
                                                                                       {<text> active</text>}}">Çok Satılana Göre 
                        @if (Model.Sort == 4)
                        {
                            if (Model.Order == 1)
                            { <img src="/Images/@(Parameters.Theme)/arrow-up.png" alt="" /> }
                            else
                            {<img src="/Images/@(Parameters.Theme)/arrow-down.png" alt="" />}
                        }</a>
                            <a onclick="SortPrice()" id="opFiyatArtan" class="opLink@{ if (Model.Sort == 2 && Model.Order == 1)
                                                                                       {<text> active</text>}}">Fiyata Artan</a>
                            <a onclick="SortPriceDesc()" id="opFiyatAzalan" class="opLink@{ if (Model.Sort == 2 && Model.Order == 2)
                                                                                            {<text> active</text>}}">Fiyata Azalan</a>
                            <a onclick="SortName()" id="opAZ" class="opLink@{ if (Model.Sort == 1)
                                                                              {<text> active</text>}}">A'dan Z'ye 
                        @if (Model.Sort == 1)
                        {
                            if (Model.Order == 1)
                            { <img src="/Images/@(Parameters.Theme)/arrow-up.png" alt="" /> }
                            else
                            {<img src="/Images/@(Parameters.Theme)/arrow-down.png" alt="" />}
                        }</a>
                            <a onclick="SortDate()" id="opYeniEski" class="opLink@{ if (Model.Sort == 3)
                                                                                    {<text> active</text>}}">Yeniden Eskiye 
                        @if (Model.Sort == 3)
                        {
                            if (Model.Order == 1)
                            { <img src="/Images/@(Parameters.Theme)/arrow-up.png" alt="" /> }
                            else
                            {<img src="/Images/@(Parameters.Theme)/arrow-down.png" alt="" />}
                        }</a>
                        </div>
                    }
                    @*sıralama*@
                    @*sayfalama*@
                    @if (Parameters.IsPaginationActive && Model.RelatedItemCount > Parameters.MaxProductCountForPage)
                    {
                        int Page = ViewBag.Page;
                        int PageCount = ((Model.RelatedItemCount - 1) / Parameters.MaxProductCountForPage) + 1;

                        if (Parameters.ShowPaginationAsDropdown)
                        {
                        <select class="paginationSelect">
                            <option disabled="disabled">Sayfa Seçiniz</option>
                            @for (int i = 1; i <= PageCount; i++)
                            {
                                <option data-page="@i" @{ if (i == Page)
                                                          {<text> selected="selected"</text>}}>Sayfa @i</option>
                            }
                        </select>
                        }
                        else
                        {
                        <ul class="pagination">
                            @if (Page > 1)
                            {
                                <li>
                                    <a onclick="applyPagination(1)"><i class="glyphicon glyphicon-step-backward"></i></a>
                                </li>
                                <li>
                                    <a onclick="applyPagination(@(Page - 1))"><i class="glyphicon glyphicon-chevron-left"></i></a>
                                </li>
                            }
                            else
                            {
                                <li class="paginate-deac">
                                    <a><i class="glyphicon glyphicon-step-backward"></i></a>
                                </li>
                                <li class="paginate-deac">
                                    <a><i class="glyphicon glyphicon-chevron-left"></i></a>
                                </li>                                
                            }
                            @for (int i = 1; i <= PageCount; i++)
                            {
                                if ((Page == 1 && i <= 3) || (Page == 2 && i <= 3) || (Page == PageCount && i >= PageCount - 2) || (Page == PageCount - 1 && i >= PageCount - 2) || i <= (Page + 1) && i >= (Page - 1))
                                {   
                                <li>
                                    <a  onclick="applyPagination(@i)"
                                   @if (i == Page)
                                   { <text> class="active"</text> }><span>@i</span></a>
                                </li>
                                }
                            }
                            @if (Page < PageCount)
                            {
                                <li>
                                    <a  onclick="applyPagination(@(Page + 1))"><i class="glyphicon glyphicon-chevron-right"></i></a>
                                </li>
                                <li>
                                    <a  onclick="applyPagination(@PageCount)"><i class="glyphicon glyphicon-step-forward"></i></a>
                                </li>
                            }
                            else
                            {
                                <li class="paginate-deac">
                                    <a><i class="glyphicon glyphicon-chevron-right"></i></a>
                                </li>
                                <li class="paginate-deac">
                                    <a><i class="glyphicon glyphicon-step-forward"></i></a>
                                </li>
                                
                            }
                        </ul>
                        }
                    }
@*sayfalama*@
                </div>
            </div>
            <div class="opBorder"></div>
        </div>
    }
    <div class="products">
        <ul>
            @if (Model.RelatedProducts.Count > 0)
            {
                var itemCounter = 1;
                foreach (var item in Model.RelatedProducts)
                {
                    //if (Parameters.Theme == "HA")
                    //{
                    //    item.LinkUrl = "#";
                    //}
                    var inLastColumn = "";
                    if (columnCount != 0 && itemCounter % columnCount == 0)
                    {
                        inLastColumn = "inLastColumn";
                    }
                    else
                    {
                        inLastColumn = "";
                    }
                <li class="productLi product-block @cssColumnClass @inLastColumn s@(columnCount)@(listImageType)">
                    <div class="product-outer">
                        <div class="product-inner">
                            <div class="product-image product-image-block">
                                <a id="pr_@item.ProductId" class="prdLink" href="@item.LinkUrl" title="@(item.ProductName.Replace("\"", ""))" @{ if (Model.FilterEnabled)
                                                                                                                                                 { <text>target="_blank"</text>}}>
                                    @if (item.ProductImageCount > 0)
                                    {
                                        <img id="ip_@item.ProductId" src="@(Parameters.WebSiteImageUrl)/product-medium/@(item.ProductId)_1@(listImageType).jpg" alt="@(item.ProductName.Replace("\"", ""))" />
                                    }
                                    else
                                    {
                                        <img id="ip_@item.ProductId" src="/Images/@Parameters.Theme/product-image-not-found-200x@(listImageType).jpg" alt="@(item.ProductName.Replace("\"", ""))" />
                                    }


                                </a>
                                <a class="incele" href="@item.LinkUrl" title="@(item.ProductName.Replace("\"", ""))" @{ if (Model.FilterEnabled)
                                                                                                                        { <text>target="_blank"</text>}}>İncele</a>
                                @if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                {
                                    <a href="@item.LinkUrl" @{ if (Model.FilterEnabled)
                                                               { <text>target="_blank"</text>}}>
                                        @if (Parameters.Theme == "HA")
                                        {
                                            var bottomAbsolute = 10;
                                            if (!string.IsNullOrEmpty(item.SpecialText))
                                            {
                                            <div class="productprop prop_specialtext hidden-xs hidden-sm" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_text">
                                                        <span>@item.SpecialText</span>
                                                    </div>
                                                </div>
                                            </div>
                                                bottomAbsolute += 31;
                                            }
                                            if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                            {
                                                if (item.FastCargo)
                                                {
                                                    var fastStr = "Hızlı Kargo";
                                                    if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                    {
                                                        fastStr = "24 Saatte Kargo";
                                                    }
                                            <div class="productprop prop_24h" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_icon"></div>
                                                    <div class="prop_text">
                                                        <div class="prop_text_left"></div>
                                                        <span>@fastStr</span>
                                                    </div>
                                                </div>
                                            </div>
                                                    bottomAbsolute += 31;
                                                }
                                                else if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                {
                                            <div class="productprop prop_24h" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_icon"></div>
                                                    <div class="prop_text">
                                                        <div class="prop_text_left"></div>
                                                        <span>24 Saatte Kargo</span>
                                                    </div>
                                                </div>
                                            </div>
                                                    bottomAbsolute += 31;
                                                }
                                                else if (item.DeliveryPeriod == "Gün" && item.DeliveryTime <= Parameters.MinDeliveryTimeForFastCargo && item.DeliveryTime > 0)
                                                {
                                            <div class="productprop prop_24h" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_icon"></div>
                                                    <div class="prop_text">
                                                        <div class="prop_text_left"></div>
                                                        <span>Hızlı Kargo</span>
                                                    </div>
                                                </div>
                                            </div>
                                                    bottomAbsolute += 31;
                                                }

                                                if (item.FreeCargo)
                                                {
                                            <div class="productprop prop_free" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_icon"></div>
                                                    <div class="prop_text">
                                                        <div class="prop_text_left"></div>
                                                        <span>Ücretsiz Kargo</span>
                                                    </div>
                                                </div>
                                            </div>
                                                    bottomAbsolute += 31;
                                                }
                                                if (item.OpportunityProduct)
                                                {
                                            <div class="productprop prop_oppoturnity" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_icon"></div>
                                                    <div class="prop_text">
                                                        <div class="prop_text_left"></div>
                                                        <span>Fırsat Ürünü</span>
                                                    </div>
                                                </div>
                                            </div>
                                                    bottomAbsolute += 31;
                                                }
                                                if (!string.IsNullOrEmpty(item.GiftString))
                                                {
                                            <div class="productprop prop_gift" style="bottom: @(bottomAbsolute)px;">
                                                <div class="prop_content">
                                                    <div class="prop_icon"></div>
                                                    <div class="prop_text">
                                                        <div class="prop_text_left"></div>
                                                        <span>@item.GiftString</span>
                                                    </div>
                                                </div>
                                            </div>
                                                }
                                                if (item.NewProduct)
                                                {
                                            <div class="prop_new"></div>
                                                }
                                                if (item.DiscountPercent > 0)
                                                {
                                            <div class="prop_discountPercent discountView2"><span>%</span>@Convert.ToInt32(item.DiscountPercent)<span class="dsccls">İNDİRİM</span></div>
                                                }
                                                else if (item.DiscountTotal > 0)
                                                {
                                            <div class="prop_discountPercent discountView2">@Convert.ToInt32(item.DiscountTotal)@Html.Raw(item.Currency == "TL" ? "<i class=\"fa fa-try\"></i>" : " " + item.Currency)<span class="dsccls">İNDİRİM</span></div>                                        
                                                }
                                                else if (item.DiscountDisplayTotal > 0)
                                                {
                                            <div class="prop_discountPercent discountView2"><span>%</span>@Convert.ToInt32(item.DiscountDisplayTotal)<span class="dsccls">İNDİRİM</span></div>                                    
                                                }
                                            }
                                        }
                                        else
                                        {
                                            var leftAbsolute = 5;
                                            var bottomAbsolute = 1;
                                            //var topAbsolute = 190;
                                            //if (Parameters.Theme == "JB")
                                            //{
                                            //    topAbsolute = 246;
                                            //}
                                            if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                            {
                                                if (item.FastCargo)
                                                {
                                                    var fastImg = "Fast";
                                                    var fastStr = "1-3 Gün Kargo";
                                                    if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                    {
                                                        fastImg = "24h";
                                                        fastStr = "24 Saatte Kargo";
                                                    }
                                            <div class="label_fast prod_label" style="left:@(leftAbsolute)px;">
                                                <img src="/Images/@(Parameters.Theme)/@{@fastImg}.png" alt="@fastStr" />
                                            </div>
                                                }
                                                else if (item.InStockDepo >= Parameters.MinInStockAmountForFastCargo && Parameters.MinInStockAmountForFastCargo != 0)
                                                {
                                            <div class="label_fast prod_label" style="left:@(leftAbsolute)px;">
                                                <img src="/Images/@(Parameters.Theme)/24h.png" alt="24 Satte Kargo" />
                                            </div>
                                                }
                                                else if (item.DeliveryPeriod == "Gün" && item.DeliveryTime <= Parameters.MinDeliveryTimeForFastCargo && item.DeliveryTime > 0)
                                                {
                                            <div class="label_fast prod_label" style="left:@(leftAbsolute)px;">
                                                <img src="/Images/@(Parameters.Theme)/Fast.png" alt="Hızlı Kargo" />
                                            </div>
                                                }
                                                if (item.FreeCargo)
                                                {
                                            <div class="label_free prod_label" style="bottom:@(bottomAbsolute)px;">
                                                <img src="/Images/@(Parameters.Theme)/Free.png" />
                                            </div>
                                                    bottomAbsolute += 14;
                                                }
                                                if (item.OpportunityProduct)
                                                {
                                            <div class="label_opportunity prod_label" style="bottom:@(bottomAbsolute)px;">
                                                <img src="/Images/@(Parameters.Theme)/Opportunity.png" />
                                            </div>
                                                    bottomAbsolute += 14;
                                                }
                                                if (item.NewProduct)
                                                {
                                            <div class="label_new prod_label" style="bottom:@(bottomAbsolute)px;">
                                                <img src="/Images/@(Parameters.Theme)/New.png" />
                                            </div>
                                                    bottomAbsolute += 14;
                                                }
                                                if (item.DiscountPercent > 0)
                                                {
                                            <div class="prop_discountPercent"><span>%</span>@Convert.ToInt32(item.DiscountPercent)</div>
                                                }
                                                else if (item.DiscountDisplayTotal > 0)
                                                {
                                            <div class="prop_discountPercent"><span>%</span>@Convert.ToInt32(item.DiscountDisplayTotal)</div>                                        
                                                }
                                            }
                                        }
                                    </a>
                                }
                            </div>
                            <a class="hizliBak" href="#quickViewContainer" title="@(item.ProductName.Replace("\"", ""))" data-id="@item.ProductId" data-name="@item.ProductName" data-prcode="@item.ProductCode" data-imgcount="@item.ProductImageCount"></a>
                            @if (!showNamesBottom)
                            {
                                <div class="product-title">
                                    <a id="pl_@item.ProductId" class="prdLink" href="@item.LinkUrl" @{ if (Model.FilterEnabled)
                                                                                                       { <text>target="_blank"</text>}}>@(item.ProductName)</a>
                                </div>
                            }
                            <div class="product-price">
                                @{
                            var priceFilterStr = "###,###,##0.00";
                            if (Parameters.HideOddFromPrice)
                            {
                                priceFilterStr = "###,###,##0";
                            }

                            var productOldPrice = item.OldPrice > 0 ? item.OldPrice.ToString("###,###,##0") : "";
                            var productNewPrice = "";
                            var productExchangePrice = "";
                            decimal productNewPriceNumber = 0;
                            var productSecondPrice = "";
                                }
                                @if (Parameters.ShowExchangePricesWithoutTax && item.ExchangePrice > 0)
                                {
                                    productExchangePrice = item.ExchangePrice.ToString(priceFilterStr) + " " + item.ExchangeCurrency + " <span class=\"taxinc\">+KDV</span>";
                                }
                                @if (Parameters.ShowPricesWithoutTax && item.SpecialPriceWithOutTax > 0)
                                {
                                    productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.SpecialPriceWithOutTax) : item.SpecialPriceWithOutTax).ToString(priceFilterStr) + " " + item.Currency + " <span class=\"taxinc\">+KDV</span>";
                                    productNewPriceNumber = item.SpecialPriceWithOutTax;
                                }
                                else if (Parameters.ShowPricesWithoutTax && item.SpecialPriceWithOutTax <= 0)
                                {
                                    productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.PriceWithOutTax) : item.PriceWithOutTax).ToString(priceFilterStr) + " " + item.Currency + " </span><span class=\"taxinc\">+KDV</span>";
                                    productNewPriceNumber = item.PriceWithOutTax;
                                }
                                else if (!Parameters.ShowPricesWithoutTax && item.SpecialPrice > 0)
                                {
                                    productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.SpecialPrice) : item.SpecialPrice).ToString(priceFilterStr) + " " + item.Currency;
                                    productNewPriceNumber = item.SpecialPrice;
                                }
                                else if (!Parameters.ShowPricesWithoutTax && item.SpecialPrice <= 0)
                                {
                                    productNewPrice = (Parameters.HideOddFromPrice ? decimal.Ceiling(item.Price) : item.Price).ToString(priceFilterStr) + " " + item.Currency;
                                    productNewPriceNumber = item.Price;
                                }
                                @{
                                var rate = (item.CampaignProduct && Model.CampaignVoucherRate > 0) ? Model.CampaignVoucherRate : Model.VoucherRate;
                                if (rate > 0 && !(Parameters.OnlyUseCCandMTforOpportunityProduct && item.OpportunityProduct))
                                {
                                    productSecondPrice = ((productNewPriceNumber * rate) / (Parameters.ShowVoucherPricesWithInstallment ? Parameters.SenetTaksit1 : 1)).ToString(priceFilterStr) + " " + item.Currency;
                                }
                                }
                                <a href="@item.LinkUrl" class="sale"  @{ if (Model.FilterEnabled)
                                                                         { <text>target="_blank"</text>}}>@if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                                                                                                          {
                                                                            
                                                                             <div class="product-price-section">
                                                                                 @{
                                                                                     <span class="productNewPriceStr productPrice">@Html.Raw(productNewPrice)</span>
                                                                                                              if (!string.IsNullOrEmpty(productExchangePrice))
                                                                                                              {
                                                                                     <span class="productNewPriceStr productPrice">@Html.Raw(productExchangePrice)</span><br />
                                                                                                              }
                                                                                                              if (productSecondPrice != "")
                                                                                                              {
                                                                                     <span class="productSecondPriceStr"><span class="senetliAyda">@(Parameters.ShowVoucherPricesWithInstallment ? "ayda " : "")</span>@Html.Raw(productSecondPrice)</span>
                                                                                                              }
                                                                                 }
                                                                             </div>
                                    
                                                                                                              if (productSecondPrice != "")
                                                                                                              {
                                                                             <div class="product-price-section">
                                                                                 <span class="fiyatAciklama"><span class="fiyatAciklamaSolCizgi">- </span>Kredi Kartı<span class="fiyatAciklamaSagCizgi"> - </span></span>
                                                                                 <span class="fiyatAciklama"><span class="fiyatAciklamaSolCizgi">- </span>Senetli<span class="fiyatAciklamaSagCizgi"> - </span></span>
                                                                             </div>
                                                                                                              }
                                                                                                              if (productOldPrice != "")
                                                                                                              {
                                                                             <span class="sale-original">@productOldPrice @item.Currency</span>
                                                                                                              }
                                                                                                              else if (item.DiscountDisplayTotal > 0)
                                                                                                              {
                                                                                                                  var indirimGoster = ((Decimal.Parse(productNewPrice.Replace(" TL", "")) / (100 - item.DiscountDisplayTotal)) * 100);
                                                                             <span class="sale-original">@indirimGoster.ToString("###,###,##0") @item.Currency</span>
                                                                                                              }
                                                                                                              else if (item.MarketPrice > 0)
                                                                                                              {
                                                                             <span class="sale-original">@item.MarketPrice.ToString("###,###,##0") @item.Currency</span>
                                                                                                              }
                                                                                                          }
                                                                                                          else
                                                                                                          {
                                                                             <span style="font-weight: normal;">Tükendi</span>   
                                                                                                          }
                                </a>
                            </div>
                            @if (showNamesBottom)
                            {
                                <div class="product-title">
                                    <a id="pl_@item.ProductId" class="prdLink" href="@item.LinkUrl" @{ if (Model.FilterEnabled)
                                                                                                       { <text>target="_blank"</text>}}>@(item.ProductName)</a>
                                </div>
                            }
                            @if (Parameters.UseWishList)
                            {
                                <div class="toList">
                                    <a id="prd_@item.ProductId" onclick="addToWishList('@(item.ProductId)');" >
                                        <img src="/Images/@(Parameters.Theme)/urun-hover-list.png" title="Listeme Ekle" alt="Listeme Ekle"/>
                                    </a>
                                </div>
                            }

                            @if (!item.CheckStock || Parameters.AllowEndedProducts || item.InStockDepo > 0)
                            {
                                if (addToCartButtonStyle == 2)
                                {
                                <div class="toCart">
                                    <a id="cart_@item.ProductId" @{if (item.InstallmentNeeded)
                                                                   { <text>href="@item.LinkUrl"</text>
                                                                       if (Model.FilterEnabled)
                                                                       { <text> target="_blank"</text>}
                                                                   }
                                                                   else
                                                                   { <text>class="addToCart"</text> }} >
                                        <button class="button-alt">Sepete Ekle</button>
                                    </a>
                                </div>
                                }
                                else if (addToCartButtonStyle == 3)
                                { 
                                <div class="hover_block">
                                    <ul class="add-to-links">
                                        <li>
                                            <a id="cart_@item.ProductId" @{if (item.InstallmentNeeded)
                                                                           { <text>href="@item.LinkUrl"</text>
                                                                               if (Model.FilterEnabled)
                                                                               { <text> target="_blank"</text>}
                                                                           }
                                                                           else
                                                                           { <text>class="addToCart"</text> }} >
                                                <button type="button" class="button btn-cart">
                                                    <span>
                                                        <span>Sepete Ekle</span>
                                                    </span>
                                                </button>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                                }
                                else
                                {
                                <div class="toCart">
                                    <a id="cart_@item.ProductId" @{if (item.InstallmentNeeded)
                                                                   { <text>href="@item.LinkUrl"</text> 
                                                                       if (Model.FilterEnabled)
                                                                       { <text> target="_blank"</text>}
                                                                   }
                                                                   else
                                                                   { <text>class="addToCart"</text> }} title="Sepete Ekle">
                                        <img src="/Images/@(Parameters.Theme)/urun-hover-sepet.png" alt="Sepete Ekle" />
                                    </a>
                                </div>
                                    
                                }
                            }
                            @if (Model.IsManager || Model.IsSeoManager)
                            {
                                <div class="manageProduct">
                                    <a href="/ProductManage/Edit/@(item.ProductId)" class="urunDuzenle fancybox.iframe">
                                        <i class="fa fa-edit fa-2x"></i>
                                    </a>
                                    @if (Model.IsManager)
                                    {
                                        <a href="/Products/RemoveFromCategory/@(Model.CategoryId)/@(item.ProductId)" class="urunSil fancybox.iframe">
                                            <i class="fa fa-remove fa-2x"></i>
                                        </a>
                                        <a href="javascript:void(0);" data-productid="@(item.ProductId)" data-variantcount="@(item.VariantCount)" title="@(item.IsActive ? "Pasifleştir" : "Aktifleştir")" class="urunAktifPasif">
                                            <span class="@(item.IsActive ? "product-icon-active" : "product-icon-deactive")"></span>
                                        </a>
                                    }
                                </div>
                            }
                        </div>
                    </div>
                </li>
                            itemCounter++;
                }
            }
        </ul>
    </div>
    @if (Model.RelatedProducts.Count >= 1 && Parameters.HomePageCategoryId != Model.CategoryId)
    { 
        <div class="clearfix"></div>
        <div class="orderProducts">
            <div class="opBorder"></div>
            <div class="opLinks">
                @{
                    
        int Page = ViewBag.Page;
        int PageCount = ((Model.RelatedItemCount - 1) / Parameters.MaxProductCountForPage) + 1;
        int nowShowStart = (Parameters.MaxProductCountForPage * (Page - 1)) + 1;
        int nowShowEnd = (Parameters.MaxProductCountForPage * Page);
        if (nowShowEnd > Model.RelatedItemCount)
        {
            nowShowEnd = Model.RelatedItemCount;
        }
                    <span class="showingCount">@Model.RelatedItemCount üründen @nowShowStart-@nowShowEnd arası gösteriliyor.</span>    }
                @if (Parameters.IsPaginationActive && Model.RelatedItemCount > Parameters.MaxProductCountForPage)
                {
                    if (Parameters.ShowPaginationAsDropdown)
                    {
                    <div class="orderAndPagination">
                        <select class="paginationSelect">
                            <option disabled="disabled">Sayfa Seçiniz</option>
                            @for (int i = 1; i <= PageCount; i++)
                            {
                                <option data-page="@i" @{ if (i == Page)
                                                          {<text> selected="selected"</text>}}>Sayfa @i</option>
                            }
                        </select>
                    </div>
                    }
                    else
                    {              
                    <ul class="pagination">
                        @if (Page > 1)
                        {
                            <li>
                                <a onclick="applyPagination(1)"><i class="glyphicon glyphicon-step-backward"></i></a>
                            </li>
                            <li>
                                <a onclick="applyPagination(@(Page - 1))"><i class="glyphicon glyphicon-chevron-left"></i></a>
                            </li>
                        }
                        else
                        {
                            <li class="paginate-deac">
                                <a><i class="glyphicon glyphicon-step-backward"></i></a>
                            </li>
                            <li class="paginate-deac">
                                <a><i class="glyphicon glyphicon-chevron-left"></i></a>
                            </li>                                
                        }
                        @for (int i = 1; i <= PageCount; i++)
                        {
                            if ((Page == 1 && i <= 3) || (Page == 2 && i <= 3) || (Page == PageCount && i >= PageCount - 2) || (Page == PageCount - 1 && i >= PageCount - 2) || i <= (Page + 1) && i >= (Page - 1))
                            {   
                            <li>
                                <a  onclick="applyPagination(@i)"
                                   @if (i == Page)
                                   { <text> class="active"</text> }><span>@i</span></a>
                            </li>
                            }
                        }
                        @if (Page < PageCount)
                        {
                            <li>
                                <a  onclick="applyPagination(@(Page + 1))">Sonraki&nbsp;<i class="glyphicon glyphicon-chevron-right"></i></a>
                            </li>
                            <li>
                                <a  onclick="applyPagination(@PageCount)">Son Sayfa&nbsp;<i class="glyphicon glyphicon-step-forward"></i></a>
                            </li>
                        }
                        else
                        {
                            <li class="paginate-deac">
                                <a><i class="glyphicon glyphicon-chevron-right"></i></a>
                            </li>
                            <li class="paginate-deac">
                                <a><i class="glyphicon glyphicon-step-forward"></i></a>
                            </li>
                                
                        }
                    </ul>
                    }
                }
            </div>
            <div class="opBorder"></div>
        </div>
    }
    <input type="hidden" value="@Model.MaxPriceTotal" id="maxPriceDefault" />
    <input type="hidden" value="@Model.MinPriceTotal" id="minPriceDefault" />
    @if (Model.RelatedItemCount == 0)
    {
        <div class="bg-info bs-bgb" style="margin-bottom: 15px; color: #000000;">
            <span class="glyphicon glyphicon-info-sign"></span>&nbsp;Ürün bulunamadı.
        </div>
    }
</div>
@Html.HiddenFor(h => h.Sort)
@Html.HiddenFor(h => h.Order)
@Html.HiddenFor(h => h.Brand)
@Html.HiddenFor(h => h.SearchText)
<script type="text/javascript">
    function addToWishList(id)
    {
        $("#dialog-form").load("/WishList/List", { ProductId: id });
        $("#dialog-form").dialog("open");
    }
    $(function ()
    {
        $("#dialog:ui-dialog").dialog("destroy");
        $("#dialog-form").dialog({
            autoOpen: false,
            height: 300,
            width: 550,
            modal: true,
            close: function ()
            {
                allFields.val("").removeClass("ui-state-error");
            }
        });
        $('.products ul li .product-outer .product-inner .product-image a.prdLink img').each(function ()
        {
            if ($(this).width() == "null")
            {
                $(this).parent().append($(this).width());
                $(this).attr('src', '/Images/@Parameters.Theme/product-image-not-found-200x@(listImageType).jpg');
            };
        });
    });
    var selectedBrands = "";
    var selectedProperties = "";
    function SortPrice()
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: 2, order: '@(Model.Sort != 2 ? 1 : Model.Order == 1 ? 1 : 1)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }
    function SortPriceDesc()
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: 2, order: '@(Model.Sort != 2 ? 2 : Model.Order == 2 ? 2 : 2)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }
    function SortName()
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: 1, order: '@(Model.Sort != 1 ? 1 : Model.Order == 1 ? 2 : 1)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }
    function SortDate()
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: 3, order: '@(Model.Sort != 3 ? 3 : Model.Order == 1 ? 2 : 1)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }
    function SortSales()
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: 4, order: '@(Model.Sort != 4 ? 4 : Model.Order == 1 ? 2 : 1)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }
    function SortMinMaxPrice()
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: '@(Model.Sort)', order: '@(Model.Order)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }

    $(".brand-selection").click(function (event)
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: '@(Model.Sort)', order: '@(Model.Order)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
        event.stopImmediatePropagation();

    });
    $(".property-selection").click(function (event)
    {
        var thisclass = $(this).attr("class");
        $("." + thisclass.replace(" ", ".")).not(this).prop('checked', false);
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: '@(Model.Sort)', order: '@(Model.Order)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: 1, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
        event.stopImmediatePropagation();
    });

    $('select.SortAndOrderSelect').change(function ()
    {
        var selectedOrder = $(this).find(':selected').val();
        if (selectedOrder == 'SortPrice')
        {
            SortPrice();
        }
        else if (selectedOrder == 'SortPriceDesc')
        {
            SortPriceDesc();
        }
        else if (selectedOrder == 'SortName')
        {
            SortName();
        }
        else if (selectedOrder == 'SortDate')
        {
            SortDate();
        }
        else if (selectedOrder == 'SortSales')
        {
            SortSales();
        }
        else if (selectedOrder == 'SortMinMaxPrice')
        {
            SortMinMaxPrice();
        }
    });
    $('select.paginationSelect').change(function ()
    {
        var selectedPage = $(this).find(':selected').data('page');
        applyPagination(selectedPage);
    });



    function applyPagination(selectedPage)
    {
        $('#content').load('/Products/Get', { id: '@(Model.CategoryId)', sort: '@(Model.Sort)', order: '@(Model.Order)', brand: '@(Model.Brand)', itemCount: '@(Parameters.MaxProductCountForPage)', minPrice: $('#enAzUcret').val(), maxPrice: $('#enFazlaucret').val(), multipleBrands: getCheckedBrands(), multipleProperties: getCheckedProperties(), page: selectedPage, ColumnCount: '@(columnCount)', ListImageType: '@(listImageType)'.replace('_', ''), SuggestedGroup: '@(Model.SuggestedGroup)' }, function () { PushUrlUpdate(); });
    }

    function getCheckedBrands()
    {
        selectedBrands = "";
        var selectionCounter = 1;
        $(".brand-selection:checked").each(function ()
        {
            selectedBrands += $(this).val();
            if (selectionCounter < $(".brand-selection:checked").length)
            {
                selectedBrands += "-";
            }
            selectionCounter++;
        });
        return selectedBrands;
    }

    function getCheckedProperties()
    {
        selectedProperties = "";
        var selectionCounter = 1;
        var selectionCounter2 = 1;
        var thisOption;

        $(".product-filter-option-property").each(function ()
        {
            thisOption = $(this);
            if (selectionCounter == 1 && $(this).find("ul li input:checked").length > 0)
            {
                selectedProperties += $(this).find("ul li input:checked").attr("name") + "-_-";
            }
            $(this).find("ul li input:checked").each(function ()
            {
                selectedProperties += $(this).val();
                //alert($(thisOption).find("ul li input:checked", thisOption).length);
                if (selectionCounter < $(thisOption).find("ul li input:checked", thisOption).length)
                {
                    selectedProperties += "_-_";
                }
                else if (selectionCounter2 < $(".product-filter-option-property").length)
                {
                    selectedProperties += "_-_";
                    selectionCounter = 0;
                }
                selectionCounter++;
                //alert(selectionCounter);
            });
            selectionCounter2++;
        });




        //$(".property-selection:checked").each(function () {
        //    if (selectionCounter == 1) {
        //        selectedProperties += $(this).attr("name")+"___";
        //    }
        //    selectedProperties += $(this).val();
        //    //alert($(this).parent().parent().find("li").length);
        //    if (selectionCounter <= $(this).parent().parent().find("li").find("option:checked", this).length) {
        //        selectedProperties += "-**-*--*";
        //    }
        //    else {
        //        selectionCounter = 0;
        //    }
        //    selectionCounter++;
        //});
        return selectedProperties;
    }

    function PushUrlUpdate()
    {
        var url = '@(Model.LinkUrl)';

        var sort = $('#Sort').val();
        var order = $('#Order').val();
        var minPrice = $('#enAzUcret').val();
        var maxPrice = $('#enFazlaucret').val()
        var multipleBrands = getCheckedBrands();
        var multipleProperties = getCheckedProperties();
        var page = '@(ViewBag.Page)';

        var newurl = url + '?sort=' + sort + '&order=' + order + '&page=' + page;
        if (!(minPrice == '0' && maxPrice == '99999999999'))
        {
            if (minPrice != '')
            {
                newurl += '&minPrice=' + minPrice;
            }
            if (maxPrice != '')
            {
                newurl += '&maxPrice=' + maxPrice;
            }
        }
        if (multipleBrands != '')
        {
            newurl += '&multipleBrands=' + multipleBrands;
        }
        if (multipleProperties != '')
        {
            newurl += '&multipleProperties=' + multipleProperties;
        }
        //alert(newurl);
        PushUrl(document.title, newurl);
        showAllFilters();
    }

    function PushUrl(newtitle, newurl)
    {
        window.history.pushState(newtitle, newtitle, newurl);
    }

    $('a.cgLink222').click(function ()
    {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Categories/Get', { id: qsId });
        return false;
    });
    $('a.prLink222').click(function ()
    {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Products/Get', { id: qsId });
        return false;
    });
    $('a.prdLink222').click(function ()
    {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Product/Get', { id: qsId, CategoryId: '@(Model.CategoryId)' });
        return false;
    });
    $('a.addToCart').click(function ()
    {
        var qsId = $(this).attr('id').split("_")[1];
        $('#cart').load('/Cart/Insert', { id: qsId });
        $('#sepetMinimalContent').load('/Cart/GetMinimal', { showPhotos: true, ShowAcrIcrLinks: true });
        $('body,html').animate({
            scrollTop: 0
        }, 800);
        $(".sepetFull img").delay(1000).fadeOut("slow").fadeIn("slow");
        return false;
    });

    if ('@Parameters.HomePageCategoryId.ToString()' != '@Model.CategoryId.ToString()')
    {
        $('#headermodule').hide();
        if ($(document).scrollTop() > 170)
        {
            $('html, body').animate({ scrollTop: 170 }, 'slow');
        }
    }
</script>

@if (Model.RelatedProducts.Count < 1)
{
    <script>
        //$('form[name=product-filter]').hide();
    </script>
}
<div id="dialog-form" title="Liste Seç">
</div>
@if (Parameters.Theme == "BT")
{ 
    <script type="text/javascript">
        $('div.toCart a.addToCart img').attr({ 'src': '', 'alt': '' });
        $('div.toCart a.addToCart').attr({ 'class': 'addToCart exclusive ajax_add_to_cart_button btn_add_cart' });
        $(' .summary .description .cart .addToCart img').attr({ 'src': '' });
        $('li.product-height div.price br').remove();
        //$('#menu-wrap .box-category ul').attr({ 'id': 'menu-custom' });
        //$('#menu-wrap .box-category ul li:first-child').attr({ 'class': 'first' });
        //$('#menu-wrap .box-category').attr({ 'class': '' });
        $('.product-height').each(function ()
        {
            var subcatname = $(this).find('.subcatname').html();
            var viewLink = $(this).find('.subcatname a').attr('href');
            $(this).find('.price').before('<div class="subcatname1"></div>');
            $(this).find('.subcatname1').html(subcatname);
            $(this).find('.subcatname').remove();
            $(this).find('.subcatname1').attr({ 'class': 'name subcatname' });
            $(this).find('.price').find('span.taxinc').remove();
            $(this).find('.toCart').after('<div class="viewProduct">' + '<a data-placement="bottom" rel="tooltip" href="' + viewLink + '" class="button" data-original-title="Ürünü Gör" title="Ürünü Gör">Ürünü Gör</a>' + '</div>');
            $(this).find('.toCart a').attr({ 'rel': 'tooltip', 'title': 'Sepete Ekle', 'data-original-title': 'Sepete Ekle', 'data-placement': 'bottom' });
        });
    </script>
}
else if (Parameters.Theme == "JJ")
{
    <script>
        $(document).ready(function ()
        {
            if ($(window).width() < 980)
            {
                $(".products").parent().attr("class", $(".products").parent().attr("class") + " first last");
            }
        });
    </script>
}

@if (Parameters.WebSiteTrackingCode != "")
{ 
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', '@Parameters.WebSiteTrackingCode']);
        _gaq.push(['_setDomainName', '@Parameters.WebSiteTrackingDomainName']);
        _gaq.push(['_setAllowLinker', true]);
        _gaq.push(['_trackPageview']);

        (function ()
        {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>
}